package com.zn.kjj.service;

import com.zn.kjj.dao.SysLoginDao;
import com.zn.kjj.dao.SysLoginXtyhMapper;
import com.zn.kjj.entity.SysLogin;
import com.zn.kjj.entity.SysLoginXtyh;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import java.util.List;

/**
 * @author Administrator
 */
@Service
public class SysLoginXtyhImpl implements SysLoginXtyhable {
    @Autowired
    private SysLoginDao sysLoginDao;
    @Autowired
    private SysLoginXtyhMapper sysLoginXtyhMapper;
    @Override
    public int deleteByPrimaryKey(String guid) {
        return sysLoginXtyhMapper.deleteByPrimaryKey(guid);
    }

    @Override
    public int insert(SysLoginXtyh record) {
        return sysLoginXtyhMapper.insert(record);
    }

    @Override
    public int insertSelective(SysLoginXtyh record) {
        return sysLoginXtyhMapper.insertSelective(record);
    }

    @Override
    public SysLoginXtyh selectByPrimaryKey(String guid) {
        return sysLoginXtyhMapper.selectByPrimaryKey(guid);
    }

    @Override
    public int updateByPrimaryKeySelective(SysLoginXtyh record) {
        return sysLoginXtyhMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(SysLoginXtyh record) {
        return sysLoginXtyhMapper.updateByPrimaryKey(record);
    }

    @Override
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.READ_COMMITTED,timeout=36000,rollbackFor=Exception.class)
    public int insertCascade(SysLogin sysLogin, SysLoginXtyh sysLoginXtyh) {
        sysLoginDao.insert(sysLogin);
        sysLoginXtyhMapper.insertSelective(sysLoginXtyh);
        return 1;
    }

    @Override
    public List<SysLoginXtyh> selectAll() {
        return sysLoginXtyhMapper.selectAll();
    }

    @Override
    public Page<SysLoginXtyh> findByPage(int pageNo, int pageSize) {
        PageHelper.startPage(pageNo, pageSize);
        return sysLoginXtyhMapper.findByPage();
    }
}
